package com.community.mapper.repair;


import com.community.entity.Repair;
import com.community.entity.RepairItem;
import com.community.entity.Result;
import org.apache.ibatis.annotations.*;

import java.util.Date;
import java.util.List;

@Mapper
public interface RepairMapper {


    @Update("update repair set status = #{status} where id = #{id}")
    void modifyStatus(@Param("id") String id,@Param("status") int status);


    @Insert("insert into repair(id, houseId, houseInfo, description, mobile, repairItemId, repairItemName, appointment) values (#{id}, #{houseId}, #{houseInfo}, #{description}, #{mobile}, #{repairItemId}, #{repairItemName}, #{appointment})")
    void addRepair(@Param("id") String id,@Param("houseId") String houseId,@Param("houseInfo") String houseInfo, @Param("description") String description,@Param("mobile") String mobile,@Param("repairItemId") String repairItemId,@Param("repairItemName") String repairItemName,@Param("appointment") Date appointment);


    @Update("update repair set description = #{description}, mobile = #{mobile}, repairItemId = #{repairItemId}, repairItemName = #{repairItemName}, appointment = #{appointment} where id = #{id}")
    void editRepair(@Param("id") String id,@Param("description") String description,@Param("mobile") String mobile,@Param("repairItemId") String repairItemId,@Param("repairItemName") String repairItemName,@Param("appointment") Date appointment);


    @Select("select * from repair where id = #{id}")
    Repair getDetails(@Param("id") String id);

    @Select("select * from repairitem")
    List<RepairItem> getRepairItem();


    @Update("update repair set status = 0 where id = #{id}")
    void cancelRepair(@Param("id") String id);
}
